package com.akrc.blog.mapper;

import com.akrc.blog.model.Category;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {
	@Select("SELECT id,name,description,header_image FROM category WHERE id = ${id}")
	@Results({
			@Result(property = "id", column = "id"),
			@Result(property = "name", column = "name"),
			@Result(property = "description", column = "description"),
			@Result(property = "header_image", column = "header_image")
	})
	Category getByID(Integer id);

	@Select("SELECT * FROM category")
	List<Category> categoryList();
}